package com.fangliai.core.base.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fangliai.core.base.service.IBaseService;
import com.fangliai.core.entitiy.BaseSearch;
import com.fangliai.core.entitiy.PageResponse;

/**
 * @ClassName BaseServiceImpl
 * @Description TODO
 * @Author fangliai
 * @Date 2018/9/14 16:03
 * @Vesion 1
**/
public class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M,T> implements IBaseService<T> {

    @Override
    public PageResponse<T> search(BaseSearch<T> search) {
        
        return  new PageResponse<T>(super.page(search.initPage(),search.initWrapper()));
    }
    @Override
    public List<T> searchForList(BaseSearch<T> search) {
        return   super.list(search.initWrapper());
    }
	@Override
	public Integer count(BaseSearch<T> baseSearch) {
		QueryWrapper wrapper= baseSearch.initWrapper();
		return super.count(wrapper);
	}
}
